<?php

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */

    $mtid = Yii::app()->mainsms->send(array('0182861387'), 'Hello! It works!', 'Test Man');
    if ($mtid < 0) {
        switch ($mtid) {
            case -100:
                Yii::app()->user->setFlash('error', "<strong>apipassname or apipassword is invalid</strong>");
                break;
            case -200:
                Yii::app()->user->setFlash('error', "<strong>senderid parameter is invalid</strong>");
                break;
            case -300:
                Yii::app()->user->setFlash('error', "<strong>mobileno parameter is invalid</strong>");
                break;
            case -400:
                Yii::app()->user->setFlash('error', "<strong>languagetype is invalid</strong>");
                break;
            case -500:
                Yii::app()->user->setFlash('error', "<strong>Invalid characters in message</strong>");
                break;
            case -600:
                Yii::app()->user->setFlash('error', "<strong>Insufficient credit balance</strong>");
                break;
            default:
                Yii::app()->user->setFlash('info', "<strong>No message returned.</strong>");
        }
    } else {
        $status = Yii::app()->mainsms->status($mtid);
        switch ($status) {
            case 0:
                Yii::app()->user->setFlash('success', "<strong>Success receive on mobile handset</strong>");
                break;
            case 100:
                Yii::app()->user->setFlash('success', "<strong>Message delivered to Telco</strong>");
                break;
            case -100:
                Yii::app()->user->setFlash('error', "<strong>mtid invalid / not found</strong>");
                break;
            case -200:
                Yii::app()->user->setFlash('error', "<strong>Message sending fail</strong>");
                break;
            default:
                Yii::app()->user->setFlash('info', "<strong>No message returned.</strong>");
        }
    }

    $this->widget('bootstrap.widgets.TbAlert', array(
        'block' => true, // display a larger alert block?
        'fade' => true, // use transitions?
        'closeText' => '&times;', // close link text - if set to false, no close link is displayed
        'alerts' => array(// configurations per alert type
            'success' => array(
                'block' => true,
                'fade' => true,
                'closeText' => '&times;'
            ), // success, info, warning, error or danger
        ),
    ));
?>